package cn.credit.loan.service.grant;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.credit.loan.dao.grant.GrantMapper;
import cn.credit.loan.entity.Grant;
@Service
@Transactional
public class GrantServiceImpl implements GrantService {

	@Autowired
	private GrantMapper grantMapper;
	  
	/**
	 * 发放员登录
	 */
	@Override
	public Grant grantlogin(String grantName, String grantPwd) {
		if(grantName.trim()!=null && grantPwd.trim()!=null){
			Grant grant=grantMapper.grantlogin(grantName, grantPwd);
			if(grant!=null){
				return grant;
			}
		}
		return null;
	}

	/**
	 * 添加发放员
	 */
	@Override
	public boolean grantadd(Grant grant) throws Exception {
		if(grant!=null){
			if(grantMapper.grantadd(grant)>0){
				return true;
			} 
		}
		return false;
	}

	/**
	 * 修改发放员
	 */
	@Override
	public boolean grantupdate(Grant grant) throws Exception {
		if(grant!=null){
			if(grantMapper.grantupdate(grant)>0){
				return true;
			}
		}
		return false;
	}

	/**
	 * 删除发放员
	 */
	@Override
	public boolean grantdelete(int grantId) throws Exception {	
		return grantMapper.grantdelete(grantId);
	}
}
